#ifndef GOOGLEMAP_H
#define GOOGLEMAP_H

#include <vector>
#include <string>
#include <afxinet.h>

#include "URLEncode.h"

class GoogleMap {
public:
	GoogleMap(const CString apiKey);

	CString getGeocodeError(int errorCode);
	CString urlEncode(CString str);
	CString getGeocodeUrl(CString address);
	CString getMapUrl(int width, int height, double lng, double lat, int zoom, CString format);
	BYTE* loadHttpFile(CString url, long &length);
	std::vector<double> geocodeAddress(CString address);
	CString makeImgFile(const BYTE * data, long len);
	std::vector<CString> getAddressesFromKey(CString key);
	void addMarker(double lat, double lon);
	void getCoordByAddr(CString addr, double &lat, double &lng);
	CString getDescriptivLocationUrl(double &lat, double &lng);
	CString GoogleMap::loadHttpFile(CString url);
	CString getKeywordUrl(double lat, double lon, CString keyword);

	static std::vector<CString> split(CString s, char sep);
private:
	CString m_szAPIKey;
	int offset; 
	double radius;
	std::vector<CString> m_liMarkers;
};


#endif